<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
    <style>
        /* 时间段 v-enter 动画进入  v-leave-to 动画离开 */
        .v-enter,
        .v-leave-to{
            opacity: 0;
            transform: translateX(150px);
        }

        /* .v-enter-active 和 .v-leave-active  分别指动画进入时间段 以及离开时间段*/
        .v-enter-active,
        .v-leave-active{
            transition: all 0.4s ease;
        }

        .my-enter,
        .my-leave-to{
            opacity: 0;
            transform: translateY(150px);
        }
        .my-enter-active,
        .my-leave-active{
            transition: all 0.4s ease;
        }

    </style>


</head>
<body>
    <div id="app">
        <input type="button" value="toggle" @click="flag=!flag">
        <!-- 将需要实现动画效果的标签 用<transition>标签包裹 -->
        <transition> 
            <h3 v-if="flag">Vue动画演示</h3>    
        </transition>
        <input type="button" value="toggle" @click="flag2=!flag2">
        <!-- 将需要实现动画效果的标签 用<transition>标签包裹 -->
        <transition name="my"> 
            <h3 v-if="flag2">Vue动画演示</h3>    
        </transition>
    </div>
    <script>
        var vm = new Vue({
            el : "#app",
            data: {
                flag:true,
                flag2:true
            },
            methods:{

            }
        })
    </script>
    
</body>
</html>